import Collapse from "components/Markdown/Collapse"
import Code from "components/Markdown/Code"
import Warning from "components/Markdown/Warning"
import Info from "components/Markdown/Info"

export const meta = {
  title: 'Reading Data (Go)',
  position: 30,
  technology: "go",
  technologyOrder: 3,
  articleGroup: "Reading Data",
}


## Overview

The Prisma client is based on the operations defined in the GraphQL schema of your Prisma API. For reading data, it basically _mirrors_ the [GraphQL queries](qwe1) of your Prisma service.

For this page, we'll assume your Prisma API is based on the following [datamodel](knul):

```graphql
type Link {
  id: ID! @unique
  createdAt: DateTime!
  description: String!
  url: String!
  postedBy: User
  votes: [Vote!]!
}

type User {
  id: ID! @unique
  name: String!
  email: String! @unique
  password: String!
  links: [Link!]!
  votes: [Vote!]!
}

type Vote {
  id: ID! @unique
  link: Link!
  user: User!
}
```

Whenever a model is queried using the Prisma client, _all scalar fields_ of that model are fetched. This is true no matter if a single object or a list of objects is queried.

For example, the following query returns all scalar fields of a single `User`:

```go
user := client.User(&prisma.UserWhereInput{ "email": "bob@prisma.io" })
```

In this case, the returned `user` object will have four properties (that correspond to the scalar fields of the `User` model): `id`, `name`, `email` and `password`. 

The `links` and `votes` fields are both _relation fields_ and are therefore not included in the query.

Here is an example of fetching a _list_ of `User` objects:

```go
users := client.Users(nil).Exec()
```

Similar to the previous query, each object inside the `users` array only has the scalar and no relation fields.